package yto.freemarker.springbootstudy.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import yto.freemarker.springbootstudy.Interceptor.ItemInterceptor;

/**
 * @author dongxing
 * @create 2018-05-28 11:07
 **/
@Configuration
public class InterceptorWebMvcConfig implements WebMvcConfigurer {

    @Bean
    public ItemInterceptor getIn() {
        return new ItemInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getIn()).addPathPatterns("/getItem/**");
    }
}
